#pragma once

#include <string>

#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
	// Microsoft visual studio, version 2005 and higher.
	#define TIXML_SNPRINTF _snprintf_s
	#define TIXML_SNSCANF  _snscanf_s
#elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
	// Microsoft visual studio, version 6 and higher.
	//#pragma message( "Using _sn* functions." )
	#define TIXML_SNPRINTF _snprintf
	#define TIXML_SNSCANF  _snscanf
#elif defined(__GNUC__) && (__GNUC__ >= 3 )
	// GCC version 3 and higher.s
	//#warning( "Using sn* functions." )
	#define TIXML_SNPRINTF snprintf
	#define TIXML_SNSCANF  snscanf
#endif

#define TILE_SMOOTH_MOVE_STEPS (60.0)

using namespace std;


class GameEngine
{
public:
	struct TileItem
	{
		int X;
		int Y;
		string JQuadName;
		int XMoveStep;
		int YMoveStep;
	};

private:
	static int ElapsedSeconds;
	static time_t StartTime;
	static int MoveCount;

private:
	static void Init();
	static void Shuffle();
	static void StartTimer();
	static void ResetTimer();
	
public:
	static TileItem Tiles[16];

public:
	static void NewGame();

	static int GetMoveCount();
	static int GetElapsedSeconds();

	static void MoveLeftTile();
	static void MoveRightTile();
	static void MoveUpTile();
	static void MoveDownTile();

	static bool IsUserWin();

	static void Resume();
	static void Pause();
};
